package com.lysj.bhp.approve.repository;

import com.lysj.bhp.approve.domain.ApproveRecord;
import com.lysj.bhp.approve.vo.ApproveRecordVo;
import jnr.ffi.annotations.In;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * @Author: ZhangWenJian
 * @Create: 2018/8/14--15:52
 * @Description: 认证档案Jpa
 */
public interface ApproveRecordRepository extends JpaRepository<ApproveRecord, Long>, JpaSpecificationExecutor {

    ApproveRecord findByUserId(Long userId);

    //身份证申请记录
    List<ApproveRecord> findByIdCardStatusOrderByIdCardRenewalDateDesc(int idCardStatus);

    //身份证审核记录
    List<ApproveRecord> findByIdCardStatusInOrderByIdCardRenewalDateDesc(Integer[] idCardStatus);

    //护照申请记录
    List<ApproveRecord> findByPptStatusOrderByPptRenewalDateDesc(int pptStatus);

    //护照审核记录
    List<ApproveRecord> findByPptStatusInOrderByPptRenewalDateDesc(Integer[] pptStatus);

    //手持照申请记录
    List<ApproveRecord> findByMultipleStatusOrderByMultipleRenewalDateDesc(int multipleStatus);

    //手持照审核记录
    List<ApproveRecord> findByMultipleStatusInOrderByMultipleRenewalDateDesc(Integer[] multipleStatus);


    //查询身份证号是否已经被使用
    int countByIdNumAndIdCardStatusIn(String idNum, Integer[] idCardStatus);

    //查询护照号是否已经被使用
    int countByPptNumAndPptStatusIn(String pptNum, Integer[] pptStatus);


}
